package com.dlc.shop.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dlc.shop.bean.model.StockBillLog;
import com.dlc.shop.bean.model.StockBillLogItem;
import com.dlc.shop.common.util.PageParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 出入库商品项
 *
 * @author LGH
 * @date 2021-09-09 13:11:15
 */
public interface StockBillLogItemMapper extends BaseMapper<StockBillLogItem> {

    /**
     * 批量保存
     *
     * @param stockBillLogId
     * @param stockBillLogItems
     */
    void insertBatch(@Param("stockBillLogId") Long stockBillLogId, @Param("stockBillLogItems") List<StockBillLogItem> stockBillLogItems);

    /**
     * 获取普通商品出入库项信息
     * @param stockBillLogId
     * @return
     */
    List<StockBillLogItem> listCommonProds(@Param("stockBillLogId") Long stockBillLogId);

    /**
     * 查询库存流水
     * @param page
     * @param stockBillLog
     * @param lang
     * @return
     */
    IPage<StockBillLogItem> flow(@Param("page") PageParam<StockBillLog> page, @Param("stockBillLog") StockBillLog stockBillLog, @Param("lang") Integer lang);

    /**
     * 批量获取待导出的库存流水列表
     * @param stockBillLog
     * @param lang
     * @return
     */
    List<StockBillLogItem> listExport(@Param("stockBillLog") StockBillLog stockBillLog, @Param("lang") Integer lang);

    /**
     * 获取sku最后操作的剩余库存数量
     *
     * @param skuIds
     * @return
     */
    List<StockBillLogItem> listSkuLateStock(@Param("skuIds") List<Long> skuIds);
}
